//
//  ContactListCell.m
//  iBaby365v2
//
//  Created by Kirinrin on 14-7-7.
//  Copyright (c) 2014年 suplus. All rights reserved.
//

#import "ContactListCell.h"
#import <UIImageView+AFNetworking.h>

@interface ContactListCell()
@property (strong, nonatomic)UIWebView *callView;
@end

@implementation ContactListCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
    }
    return self;
}

- (void)awakeFromNib
{
    NSLog(@"cell awakeFromNib");
    // Initialization code
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}


- (void)setData:(ParentInfo *)data {
    _data = data;
    
    //    UIImageView *photo = (UIImageView *)[cell viewWithTag:100];
    [_photo setImageWithURL:_data.photo placeholderImage:[UIImage imageNamed:@"imageUserPhotoDefault"]];
    [_name setText:data.name];
}
- (IBAction)beginSMSAction:(id)sender {
    NSLog(@"beginIMAction to %@", _data.phoneNumber);
    [self.viewController performSegueWithIdentifier:@"toChater" sender:self.data];

}
- (IBAction)makePhoneAction:(id)sender {
    NSLog(@"beginPhoneAction to %@", _data.phoneNumber);
    NSString *callString = [NSString stringWithFormat:@"tel://%@", _data.phoneNumber];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:callString]];
}

@end
